home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
283_01
/
fafnir.doc
< prev
next >
Wrap
Text File
|
1988-12-15
|
24KB
|
492 lines
/* fafnir.doc -- a general purpose forms engine
documentation, history
9/10/88, david c. oshel
"Why, Doc?" The user gets Elysian Fields. The programmer gets
Forms Nirvana. Fafnir got the Rheingold (*belch*).
That's why. Anyone for elevenis? -- Oshel, 9/11/88
*/
/*
============================================================================
Changes, 12/18/88:
Added Small Model support (SVIDEO.ASM). Now supports /AL and /AS.
The Fafnir small model is not especially useful in real life, since
most C programs which manage "live" databases are written, for practical
reasons, in large model. However, the small model console i/o library,
formerly distributed as CIAO.LIB, is included, and that IS useful!
Changes, 12/11/88:
Eliminated snow from CGA direct screen writes.
Microsoft Systems Journal, November 1988, article by Jeff Prosise,
detailed an "approved" algorithm for CGA snow elimination, so I did
a complete rewrite on low-level screen i/o in LIAO.LIB to include it.
Prosise's method tends toward OS/2 treatment of the screen as a general
data object (a "handle"), instead of a physical component of specific
hardware. Accordingly, I isolated all screen writes/reads in functions
with an MSJ_ prefix; these are the primitives, and contain NO ptrseg
macros at all, and NO int86's except for: ROM-BIOS cursor size and
location, and module initialization. (Other parts of the library still
use int86's, e.g., to read the system clock or the keyboard status.)
Also, corrected a few minor bugs here and there, esp. in Fafnir. Added
a "hook" so sliding text fields can call their help functions if user
presses Shift-F1, Alt-F1, or Ctrl-F1. Regular F1 still toggles the
shadow cursor in 80 column reversed field at the bottom of the screen.
The screenmessage() function no longer disturbs field attributes in the
receiving region. Added an automatic flag to the scroll routines so
the blank line at top or bottom of a scrolling window uses the original
video attribute instead of being upset by wputs().
I rewrote two of Prosise's MSJ_ functions, and added four of my own
because some of my LIAO and FAFNIR routines expect a length byte, and
because Prosise did not include an assembler version of mass moves to
and from the screen. My code is in LVIDEO.ASM. With monochrome
adapter, some of these routines are so fast you get a "wagon wheel"
effect on fields which are constantly refreshed by repeating keystroke.
The CGA snow elimination is rather slow, but seems acceptable.
I am now using *** L A R G E M O D E L *** exclusively, since nearly
all of my development puts heavy stress on the heap, and I am getting
tired of constantly tweaking code in Small Model to use far pointers.
Bugs remaining: I have not generalized the low-level I/O sufficiently
to correct problems caused when the hardware screen is wider than 80
chars or more than 25 lines. Deficiencies do not affect normal BW80
or CO80, or MA, text modes. Should always vid_init(3) or vid_init(2),
which has no effect on MA, in applications where this might be a
hassle. Upward mobility toward OS/2 or the like will probably cure
the problem automatically, since a general screen handle will include
all these dimensions and force low-level code to deal with them.
Changes, 9/30/88:
Added bomb0( char *msg,... ) routine which calls user's crash function
Added set_crash_function( PTR_TO_CRASH_FN call_on_crash )
Added exit_fafnir()
Changes, 9/24/88:
Added support for sliding fields. This turned out to be easier than
I thought it would be. Something about clear heads on Saturday a.m.'s?
Also added some idiot-proofing in the EditField routines, to prevent
still more nonsense in some really quirk-and-ditty field validaters.
Changes, 9/10/88:
Added "seek to end of text" to the END key routine. Added title and
version number to the general info. Promised that Shift_F1 would always
give the current version display. Selected Fafnir and Ciao source
code, with a stand-alone make file, suitable for distribution. Put the
F2 exit key back in; turns out this is a useful signal in some existing
programs that used earlier versions of the field editor.
Changes, 9/4/88:
Changed the dialogue boxes for shorter, intuitive messages about what
is meant. Short, sweet and Anglo-Saxon.
Changes, 9/3/88:
Major changes to formedit.h header file, includes macros for standard
field types and other elegances and graces to avoid egregious errors
and make the job easier and safer.
Changes, 9/2/88:
Added the OldRecord flag to EditForm, OnePageEdit, TwoPageEdit, and
included opening dialogue if OldRecord. These functions now return
functionally named MANIFEST CONSTANTS, instead of booleans or function
keys; except that EditForm can still return PgDn, PgUp, and End to
flag particular exit conditions. All other exits from these functions
are via user dialogue boxes.
The new return values are: SAVE_FORM, SKIP_FORM, DELETE_FORM, STOP_SEARCH
EditForm also may return: PGDN, PGUP, or END
Changes, 9/1/88:
Altered the FORM_RULES typedef so that fptr is a char **; this allows
dynamic field allocation! Added two functions to take advantage:
void AllocateFields( FORM_RULES form[], int NumFields );
void ReleaseFields( FORM_RULES form[], int NumFields );
Note that if fields are already allocated, it is not necessary to
to call either of these. Allocating and assigning to a char *
whose address is referred to in the FORM_RULES structure is a
somewhat slippery idea, but it allows for multiple occurrences of
the identical object within FORM_RULES, provided the second char **
is not within range of AllocateFields ... think about it! We gain
a major savings in space by trading off a lesser redundancy (the
cost of a field pointer plus its alias) for a greater (the cost of
two full-size field allocations, or the cost of special code to
make the alias good with an explicit memcpy), in the case of
virtual fields. The cost to the programmer, when writing FORM_RULES,
is simply to add an extra & to the name of the field's char *, plus
a little extra care in deciding who gets allocated (!). [Note to
Oshel, from Oshel: This will be clear as mud in about a month.
Please be advised that I knew what I was doing when I wrote this!]
It's a design element not easy to weigh, but it seems to me a more
powerful idea than simply allocating and assigning directly to the
fptr's lvalue within the array of FORM_RULES structures.
AllocateFields() ensures that we are working with null-terminated
ASCII strings guaranteed to be the proper length. (No more debugging
len in FORM_RULES!) This is a major simplification, especially
when moving data to and fro between forms and databases. (No other
part of the formedit module makes this assumption; it always uses
the field width, internally.) The R:Base program interface, e.g.,
works explicitly with null-terminated strings (cf. a_att(), etc.).
Changes, 8/27/88:
Defined VNOP, in formedit.h, as the "null function". Any field
initializer, character validater or field validater equal to VNOP
is equivalent to a call to a No-Operation. That is, the character
typed is valid (EditField), the field is valid, or the field is
considered to be initialized. If a character validater in FORM_RULES
is VNOP, however, the field is display-only (EditForm). Use cgood()
or the like to "validate any" printable ASCII keyboard character.
Defined DISPLAY, same as